package tanxin;

public class Solution_45 {

    public int jump(int[] nums) {
        int maxRight = 0,res=0;
        int curRight=0;
        for (int i = 0; i < nums.length - 1; i++) {
            maxRight = Math.max(maxRight, nums[i] + i);
            if (i==curRight){
                curRight=maxRight;
                res++;
            }
        }
        return res;
    }

}
